<?php
/**
 * 文章编辑页面
 *
 * @author Alen
 * @since 1.0.0 2013-10-3 sutroon
 */
class Article_EditAction extends AdmincpAction {
    
    /**
     * 默认显示方法
     */
    public function index(){
        
    $this->begin_breadcrumb();
    $this->add_breadcrumb('','');
    $this->end_breadcrumb();
    
        // 获取主键编号
        $id=request_numeric('id');
        
        $biz=new SoBizArticle();
        $data=$biz->read_one($id);
        
        // 设置页面信息,如页面标题,meta信息等
        $this->set_page_info($data['Title']);
        
        // 构建表单内容
        $this->uig->begin_form();
        $this->uig->add_textfield('标题','title',$data['Title'],'标题长度不超过30个字符');
        $this->uig->add_editorfield('内容','content',$data['Content']);
        $this->uig->add_controlfield();
        $this->uig->add_hiddenfield(array('action'=>'save'));
        $this->uig->end_form();
        $this->assign('form', $this->uig->get_text());   
        
        // 显示模板
        $this->display();
    }
    
    public function save(){
        $biz=new SoBizArticle();
        $msg=$biz->save();
        if($msg=='SUCCESS'){            
            redirect('保存成功','?m=Article_List');
        }else{
            redirect($msg);
        }
    }

    public function set_page_info() {
        
    }

}

?>
